import * as d3 from 'https://unpkg.com/d3@6?module';
let data={}
export {data};
changeGraph("forceDirectedGraph");

function changeGraph(graphName){
    if (!(data.name === graphName)) {
        d3.json(`data/${graphName}.json`).then(_ => {
            data = _;
            data.name = graphName;
            start();
        });
    }
}
function start(){
        import(`./${data.name}.js`)
            .then(module => {
                document.getElementById("graph").appendChild(module.start());
            })
}